package cn.tannn.cat.file.sdk.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 文件存储器类型字典 (支持列表)
 *
 *
 * @author <a href="https://tannn.cn/">tan</a>
 * @date 2024/3/7 13:47
 */
@AllArgsConstructor
@Getter
public enum StorageDict {

    /**
     * 本地磁盘
     */
    LOCAL_STORAGE("10","本地磁盘"),

    /**
     * minio
     */
    MINIO_STORAGE("20","minio"),

    /**
     * S3对象存储
     */
    S3_STORAGE("30","S3对象存储"),

    /**
     * 七牛云
     */
    QINIU_STORAGE("40","七牛云"),

    /**
     * 阿里云
     */
    ALI_STORAGE("50","阿里云"),

    /**
     * ftp
     */
    FTP_STORAGE("60","FTP");


    /**
     * sys_dict.value
     */
    private final String value;

    /**
     * sys_dict.label
     */
    private final String type;


    /**
     * 获取枚举实例
     * @param value value
     * @return ConfigMaster
     */
    public static StorageDict fromValue(String value) {
        for (StorageDict dict : StorageDict.values()) {
            if (Objects.equals(value, dict.getValue())) {
                return dict;
            }
        }
        throw new IllegalArgumentException();
    }
}
